#include "Part.h"

int internalId = 0;

Part::Part( std::string id ) :
	_id( id )
{
}

void Part::ProcessCommand( const Command& command )
{
	for( IteratorPtr<Rule> rules( _rules.GetIterator() );
			!rules->IsEnd( );
			rules->Next( ) )
	{
		Rule rule = rules->Current( );
		if( rule.Check( command ) )
			PerformAction( rule.GetAction( ) );
	}
}

std::string Part::GetId( ) const
{
	return _id;
}

void Part::AddRule( const Rule& rule )
{
	_rules.Add( rule );
}

void Part::RemoveRule( const Rule& rule )
{
	_rules.Remove( rule );
}
